﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace eShop.Utility
{
    public class LogHelper
    {
        // Primary namespace root for all errors that has been handled
        private const string HANDLED_FILE_LOGGER_NAME = "Handled.Logging";
        // Admin activity logging 
        private const string ADMIN_ACTION_LOGGER_NAME = "Admin.Logging";

        /// <summary>
        /// Returns a log with namespace that is nested in the handled
        /// namespace root and has the class name specified
        /// </summary>
        /// <param name="className">Name of the class where the exception occured</param>
        /// <returns>Returns a logger object</returns>
        public static ILog GetHandledFileLogger(string className)
        {
            return LogManager.GetLogger(HANDLED_FILE_LOGGER_NAME + "." + className);
        }

        /// <summary>
        /// Returns a log with namespace that is nested in the handled
        /// namespace root and has the class name specified, used to
        /// monitor admin activity.
        /// </summary>
        /// <param name="className">Name of the class where the exception occured</param>
        /// <returns>Returns a logger object</returns>
        public static ILog GetAdminActionLogger(string className)
        {
            return LogManager.GetLogger(ADMIN_ACTION_LOGGER_NAME + "." + className);
        }
    }
}
